﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using BLL;
using System.Web.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Text;

public partial class Plublic_Cards : System.Web.UI.Page
{
    String StrConn = WebConfigurationManager.ConnectionStrings["conn"].ConnectionString.ToString();
    LocationHandler objLocationHandler = new LocationHandler();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {

        if (txtAddress.Text != string.Empty)
        {
            Location objLocation = new Location();

            objLocation.Created = DateTime.Now.ToString();
            objLocation.Updated = DateTime.Now.ToString();
            objLocation.Isactive = "1";
            objLocation.Address = txtAddress.Text.ToString();
            objLocation.Descriptions = txtDescriptions.Text.ToString();

            objLocationHandler.AddNewLocation(objLocation, StrConn);
            this.setText();
        }
        else
        {
            string messagebox = "Error, please try again...!!!";
            StringBuilder stringbuilder = new StringBuilder();
            stringbuilder.Append("<script language='javascript'>");
            stringbuilder.Append("alert(\"" + messagebox + "\");");
            stringbuilder.Append("<" + "/script>");
            Response.Write(stringbuilder.ToString());
        }

    }

    protected void setText() {
        this.txtAddress.Text = "";
        this.txtDescriptions.Text = "";
    }
}